#include <algorithm>
#include <cstring>
#include <iostream>

using namespace std;

char num[300];
bool del[300];
int k, len, lst;

int main() {
    scanf("%s%d", num, &k);
    len = strlen(num);
    for (int i = 0; i < k; i++) {
        for (int j = 0; j < len; j++) {
            if (del[j] && j != len - 1)
                continue;
            lst = j;
            int nxt = j + 1;
            while (del[nxt] && nxt < len) nxt++;
            if (del[nxt]) {
                del[j] = 1;
                break;
            }
            if (num[j] > num[nxt]) {
                del[j] = 1;
                break;
            }
        }
    }
    int ind = 0;
    while ((num[ind] == '0' || del[ind]) && ind < len) ind++;
    if (ind == len)
        cout << 0;
    for (; ind < len; ind++)
        if (!del[ind])
            cout << num[ind];
}